<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>支付表费用转出记录表 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">支付表号</div>
                    <div class="field">
                        <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value=""
                               validate="{required:true}">
                        <span class="requiredSymbol">*</span>
                    </div>
                </div>

                <div class="formBtns notRight">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, callback = null, form = null;
    grid = $("#ligergrid1").ligerGrid({
        url: '<%=path%>/capital/capFeeOutLog/initList.do?qtype=0',
        method: 'get',
        columns: [
            {display: '支付表号', name: 'paySchNo', minWidth: 100, align: 'left', enabledSort: false},
            {display: '费用类型', name: 'feeTypCdNm', minWidth: 100, align: 'center', enabledSort: false},
            {
                display: '费用金额', name: 'feeAmt', minWidth: 100, align: 'right', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney(rowdata.feeAmt / 100);
                }
            },
            {
                display: '转出金额', name: 'outAmt', minWidth: 100, align: 'right', enabledSort: false,
                render: function (rowdata, index, value) {
                    return '&yen;' + FormatMoney(rowdata.outAmt / 100);
                }
            },
            {
                display: '操作', name: '', minWidth: 100, align: 'left', enabledSort: false,
                render: function (rowdata, index, value) {
                    if (rowdata.feeAmt > rowdata.outAmt && rowdata.outFlag == 1) {
                        var amt = rowdata.feeAmt - rowdata.outAmt;
                        return "<a class='sq-button-hasicon' href='javascript:;' onclick='feeOut(" + index + ")'><i class='sqBtnIco_17'></i>转出</a>";
                    }
                }
            },
        ],
        pageSize: 10,
        root: 'rows',
        record: 'total',
        hideLoadButton: true,
        width: '100%',
        height: '100%',
        heightDiff: -2,
        checkbox: true,
        rownumbers: true,
        allowUnSelectRow: true,
        alternatingRow: false,
        delayLoad: true
    });
    grid.setHeight(100);

    form = $("#searchBar").ligerForm({
        validate: true
    });

    $("#pageloading").hide();


    /* 查询 */
    $("#searchBtn").click(function (event) {
        if (!form.valid()) {
            $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
            return false; //验证不通过，不执行以下代码
        }
        form = liger.get("searchBar");
        var data = form.getData();
        for (name in data) {
            grid.setParm(name, data[name]);
        }
        grid.reload();
    });

    /* 清空 */
    $("#clearBtn").click(function (event) {
        clearLigerForm("searchBar");
    });

    callback = function () {
        grid.reload();
    };

    function feeOut(index) {
        var data = grid.getRow(index);
        var amt = data.feeAmt - data.outAmt;
        var req = "?paySchId=" + data.paySchId + "&paySchNo=" + data.paySchNo + "&paySchDId=" + data.paySchDId + "&feeTypCd=" + data.feeTypCd + "&feeAmt=" + data.feeAmt + "&outAmt=" + amt;
        $.ligerDialog.open({
            width: 550,
            height: 400,
            title: '保证金转出',
            url: '<%=path%>/capital/capFeeOutLog/toAddPage.do' + req
        });
    }

</script>

</body>
</html>
